﻿using Customer.Domain;
using Customer.Infrstructre.FinanceManager;
using Customer.Read.API.Applcation.Command.FinanceTypeCommand;
using MediatR;

namespace Customer.Read.API.Applcation.CommandHandler.FinanceTypeCommandHandler
{
    /// <summary>
    /// 反填财务类别
    /// </summary>
    public class FanFinanceTypeCommandHandler:IRequestHandler<FanFinanceTypeCommand,FinanceType>
    {
        private readonly IFinanceTypeRepository _financeRepository;

        public FanFinanceTypeCommandHandler(IFinanceTypeRepository financeRepository)
        {
            _financeRepository = financeRepository;
        }

        public async Task<FinanceType> Handle(FanFinanceTypeCommand request, CancellationToken cancellationToken)
        {
            return await _financeRepository.GetModelAsync(request.id);
        }
    }
}
